package com.pb.poem.util;
public class Page {
	private int  totalPageCount=1;
	private int pageSize=0;
	private int recordCount=0;
	private int currPageNo=1;


	public int getCurrPageNo() {
//	 if(totalPageCount==0){
//		 return 0;
//	 }
		return currPageNo;
	 
	}
	public void setCurrPageNo(int currPageNo) {
//		if(currPageNo>totalPageCount){
//			this.currPageNo=totalPageCount;
//		}else if(currPageNo<1){
//			this.currPageNo=1;
//		}else{
		this.currPageNo = currPageNo;
//	}
	}
	public int getTotalPageCount() {
		return totalPageCount;
	}
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	//设置总页数
	public int getRecordCount() {
		return recordCount;
	}
	public void setRecordCount(int recordCount) {
		if(recordCount>0){
		this.recordCount = recordCount;
		this.setTotalPageCountByRs();
		}
	}
	//设置总页数
	public void setTotalPageCountByRs(){
		if(this.recordCount%this.pageSize==0){
			this.totalPageCount=this.recordCount/this.pageSize;
		}else  if(this.recordCount%this.pageSize>0){
			this.totalPageCount=this.recordCount/this.pageSize+1;
		}else{
			this.totalPageCount=0;
		}
	}
	//得到开始记录数
	public int getStartRow(){
		return (currPageNo-1)*pageSize;
	}
	//得到结束记录数
	public int getEndRow(){
		return currPageNo*pageSize;
	}
}

